/**
 * Created by Administrator on 2017/3/1.
 */
function commPost(url,data,callback,ecallback,accessToken){


    $.ajax({
        headers:{accessToken: accessToken},
        type: 'POST',
        url:url,
        data:JSON.stringify(data),
        dataType:"json",
        contentType:"application/json",
        cache: false,
        success:function(data){

            if(callback){


                callback(data);
            }



        },
        error:ecallback||myerror
    });

}


function commGet(url,data,callback,ecallback,accessToken){

    $.ajax({
        headers:{accessToken: accessToken},
        type: 'GET',
        url:url,
        data:data,
        dataType:"json",
        contentType:"application/json",
        cache: false,
        success:function(data){
            if(callback)
                callback(data);





        },
        error:ecallback||myerror
    });

}
function commDel(url,data,callback,ecallback,accessToken){


    $.ajax({
        headers:{accessToken: accessToken},
        type: 'DELETE',
        url:url,
        data:data,
        dataType:"json",
        contentType:"application/json",
        cache: false,
        success:function(data){



            if(callback){


                callback(data);
            }




        },
        error:ecallback||myerror
    });

}

function commPut(url,data,callback,ecallback,accessToken){


    $.ajax({
        headers:{accessToken: accessToken},
        type: 'PUT',
        url:url,
        data:JSON.stringify(data),
        dataType:"json",
        contentType:"application/json",
        cache: false,
        success:function(data){



            if(callback){


                callback(data);
            }




        },
        error:ecallback||myerror
    });

}
function mysuccess(data, textStatus, jqXHR){

    // alert(data);

}
function myerror (XMLHttpRequest, textStatus, errorThrown){


    if( olUtile!=null){

        olUtile.closeLoading();
    }

    //alert(textStatus+""+errorThrown);
    //  alert(XMLHttpRequest.readyState);
}

window.commGet = commGet;
window.commPost = commPost;
window.commPut = commPut;


